#!/bin/bash
cd $1

config='config.js'
if [ -f '../config.js' ]; then
    config='../config.js'
fi

existConfDir=`grep exports.ConfDir $config | wc -l`
if [ $existConfDir -eq 1 ]; then
    existConfDir=`grep exports.ConfDir $config| awk '{print $3}' | awk -F';' '{print $1}' | sed s/\'//g | sed s/\"//g`
    cp /tmp/conf/*.dat $existConfDir/  
else
    cp /tmp/conf/*.dat conf/  
fi

./manage restart
